package com.nonobank.architecture.schedule;

import com.taobao.pamirs.schedule.IScheduleTaskDealSingle;
import com.taobao.pamirs.schedule.TaskItemDefine;

import java.util.List;

/**
 * Created by wuchuanhong on 2016/8/25.
 */
public abstract class AbstractTaskDealSingle<T> implements IScheduleTaskDealSingle<T>{

    final public boolean execute(T task, String ownSign) throws Exception {
        return handleTask(task,ownSign);
    }

    final public List<T> selectTasks(String taskParameter, String ownSign, int taskItemNum, List<TaskItemDefine> taskItemList, int eachFetchDataNum) throws Exception {
        return queryTasks(taskParameter,ownSign,taskItemNum,taskItemList,eachFetchDataNum);
    }

    protected abstract boolean handleTask(T task,String ownSign)throws Exception;

    protected abstract List<T> queryTasks(String taskParameter, String ownSign, int taskItemNum, List<TaskItemDefine> taskItemList, int eachFetchDataNum);
}
